<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Task extends Model
{
    //
    protected $guarded = [];




    //Relation
    public function author()
    {
        return $this->belongsTo('App\User','userid');
    }

    public function comments()
    {
        return $this->hasMany('App\Comment','taskid');
    }

    public function child()
    {
        // @Todo Add Task Relation refer to links
//        return $this->hasMany('App\Task','')
        return $this->belongsToMany('App\Task','links','first','second');
    }

    public function father()
    {
        return $this->belongsToMany('App\Task','links','second','first');
    }
}
